<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>js</title>
	<style>

	</style>
</head>
<body>
	<form action="">
		<p>用户名：</p>
		<p><input type="text" id='ipt' value='小金'></p>
		<p>密码：</p>
		<p><input type="text" value='123456'></p>
		
		<p><input type="submit" value='ok'></p>
	</form>
</body>

<script>

/*
input 点击后，文本框颜色去掉
Input{outline:0;}
*/

//onfocus获得焦点事件
	iptobj=document.getElementById('ipt');
	iptobj.onfocus=function(){
		//input 点击后，文本框颜色变为红色
		this.style.outlineColor='#f00';

		//input 点击后，文本框value值为空
		this.value='';
	}
</script>
</html>